<?php
/**
 * Created by PhpStorm.
 * Author: 黑瞎子
 * Date: 2018/3/17
 * Time: 9:14
 */

namespace app\api\controller\v1;


use app\api\model\Category as CategoryModel;
use app\lib\exception\CategoryException;

class Category
{
    /*
     * 获取所有分类
     * */
    public function getAllCategories(){
        $categories = CategoryModel::all([], 'img');
        if ($categories->isEmpty()){
            throw new CategoryException();
        }
        return $categories;
    }
}